﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FileNameChangeApplication3._0
{
    public class TxtHelper
    {
        public static void txtWrite(string txtFulPath, string WriteContent)
        {
            if (!File.Exists(txtFulPath))
            {
                FileStream fs = new FileStream(txtFulPath, FileMode.OpenOrCreate);
                fs.Close();
            }
            using (StreamWriter sw = new StreamWriter(txtFulPath, append: true))
            {
                sw.Write(WriteContent);
                sw.Close();
            }
        }
        public static void txtWrite(string txtFulPath, ZdxxMessage message)
        {
            FileStream fs = new FileStream(txtFulPath, FileMode.Truncate, FileAccess.ReadWrite);
            fs.Close();
            txtWrite(txtFulPath, "宗地号:" + message.zdh + "\r\n");
            txtWrite(txtFulPath, "电话号码:" + message.dhhm + "\r\n");
            txtWrite(txtFulPath, "建房年代:" + message.jfnd + "\r\n");
            txtWrite(txtFulPath, "与户主关系:" + message.yhzgx + "\r\n");
            txtWrite(txtFulPath, "与原权利人关系:" + message.yyqlrgx + "\r\n");
            txtWrite(txtFulPath, "备注1:" + message.bz1 + "\r\n");
            txtWrite(txtFulPath, "备注2:" + message.bz2 + "\r\n");
            txtWrite(txtFulPath, "新增宗地:" + message.xzzd + "\r\n");
        }
    }
}
